<!--  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>-->
<script src="{{STATIC_URL}}js/jquery.min.js"> </script>
<script src="{{STATIC_URL}}js/jquery.colorbox.js"> </script>
<script type="text/javascript" src="{{STATIC_URL}}js/pic.js"> </script>
<script type="text/javascript" src="{{STATIC_URL}}js/CJL.0.1.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/mcdropdown/lib/jquery.mcdropdown.js"></script> 
<script type="text/javascript" src="{{STATIC_URL}}js/mcdropdown/lib/jquery.bgiframe.js"></script> 
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.jeditable.js"></script>

<script type="text/javascript">
	$(document).ready(function(){
		//enter自动切换输入框
		$('input:text:first').focus();
		var $inp = $('input');
		$inp.bind('keydown', function (e) {
			var key = e.which;
		    if (key == 13) {
			    e.preventDefault();
			    var nxtIdx = $inp.index(this) + 1;
			    $("input:eq(" + nxtIdx + ")").focus();
		    }
		});

		//我的菜单
		mymenu = $("#floatMenu");
        menuYloc = parseInt(mymenu.css("top").substring(0, mymenu.css("top").indexOf("px")))
        $(window).scroll(function() {
            offset = menuYloc + $(document).scrollTop() + "px";
            mymenu.animate({ top: offset }, { duration: 500, queue: false });
        });
        
		$("#order_dish_show").click(function(){
    		$("#my_litie_orderDish").slideToggle();			
  		});
  		$("#order_dish_hide").click(function(){  
    		$("#my_litie_orderDish").slideUp("fast");	
  		});
  
  		$("#order_dish_show").hover(function(){
	 		$(this).addClass("float_menu_hover");
	 	},function(){
	 		$(this).removeClass("float_menu_hover");
	 	});


  		$(document).ajaxSend(function(event, xhr, settings) {
  		    function getCookie(name) {
  		        var cookieValue = null;
  		        if (document.cookie && document.cookie != '') {
  		            var cookies = document.cookie.split(';');
  		            for (var i = 0; i < cookies.length; i++) {
  		                var cookie = jQuery.trim(cookies[i]);
  		                // Does this cookie string begin with the name we want?
  		                if (cookie.substring(0, name.length + 1) == (name + '=')) {
  		                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
  		                    break;
  		                }
  		            }
  		        }
  		        return cookieValue;
  		    }
  		    function sameOrigin(url) {
  		        // url could be relative or scheme relative or absolute
  		        var host = document.location.host; // host + port
  		        var protocol = document.location.protocol;
  		        var sr_origin = '//' + host;
  		        var origin = protocol + sr_origin;
  		        // Allow absolute or scheme relative URLs to same origin
  		        return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
  		            (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
  		            // or any other URL that isn't scheme relative or absolute i.e relative.
  		            !(/^(\/\/|http:|https:).*/.test(url));
  		    }
  		    function safeMethod(method) {
  		        return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
  		    }

  		    if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
  		        xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
  		    }
  		});
  			 	
	});
</script>

